/*****************************************************************
 MYD Engine v0.1

 file: myd_animation.h
 created: 06/07/09
*****************************************************************/

#ifndef MYD_ANIMATION_H
#define MYD_ANIMATION_H

#include "system/myd_system.h"

namespace myd
{
	struct Frame
	{
		unsigned int frOffsetX;
		unsigned int frOffsetY;
		unsigned int frWidth;
		unsigned int frHeight;
	};
	class MYD_API Animation
	{
		// constructor / destructor
		public:
			Animation ();
			~Animation ();

			void addFrame(unsigned int xoff, unsigned int yoff, 
						  unsigned int width, unsigned int height);

			void setParameters(float tm_speed, int tm_frameCount, bool tm_looped);

			unsigned int calculateFrame(float fAppTime);

		private:
			std::vector<Frame> framesList;

		//properties
			float speed;
			float fAppInitTime;
			int frameCount;
			
		public:
			bool isPlaying;
			bool looped;

		public:
			Frame Animation::getFrameInfo(unsigned int frameIndex);
			void play(void);
			void stop(void);
	};
	#include "myd_animation.inl"
}// end namespace
#endif // MYD_ANIMATION_H
